﻿using System;
using System.Collections.Generic;
using System.Xml.Serialization;

namespace SelfMeter.Data.Test
{
    public class TestDataGen
    {
        public static MeterDefinition GenRandomTestData(string name, string description, string unit, DateTime start, int days, int max, int min)
        {
            var meter = new MeterDefinition
            {
                ID = Guid.NewGuid(),
                Name = name,
                Description = description,
                Unit = unit,
                MeterData = new List<MeterItem>(days)
            };

            var random = new Random();
            for(int i=0; i<days; i++)
            {
                meter.MeterData.Add (new MeterItem
                {
                    Data = random.Next(min, max),
                    Date = start.AddDays(i)
                });
            }

            return meter;
        }
    }
}